linux安装jupyter notebook | 您所在的位置:网站首页 › jupyter notebook突然打不开 › linux安装jupyter notebook |
目录 使用miniconda的conda安装 切换conda镜像源有两种方法: 设置密码: 修改配置文件: 启动 关闭进程: 使用miniconda的conda安装 conda install jupyter如果镜像不好用则切换conda镜像源 切换conda镜像源有两种方法:1. [shuqiq@shuqiq bin]$ ./conda config --add default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main [shuqiq@shuqiq bin]$ ./conda config --add default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r [shuqiq@shuqiq bin]$ ./conda config --add default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 #查看一下源 [shuqiq@shuqiq bin]$ ./conda config --show #设置安装包时,显示镜像来源,建议显示 [shuqiq@shuqiq bin]$ ./conda config --set show_channel_urls yes #恢复默认源 [shuqiq@shuqiq bin]$ ./conda config --remove-key channels #删除一条镜像源 [shuqiq@shuqiq bin]$ ./conda config --remove-key channels2. 执行一次conda config 命令 自动创建.condarc文件,即在/home/user目录下出现.condarc文件 修改配置文件内容: [shuqiq@shuqiq ~]$ vi ./.condarc show_channel_urls: true ssl_verify: true channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - defaults 设置密码:需要使用到ipython 安装ipython linux安装ipython_舒奇Q的博客-CSDN博客https://blog.csdn.net/qq_53368181/article/details/130685413 [shuqiq@shuqiq bin]$ ./ipython In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:7a75f56c1667:34209c98504382b676d726efb9ba7af95a28465f'返回的sha1这串hash值修改配置文件时要用 使用 from IPython.lib import passwd 也可以设置密码 修改配置文件:打开配置文件jupyter_notebook_config.py,这个文件在用户的家目录下的.jupyter目录里 直接追加到最后,或者备份一份原文件 [shuqiq@shuqiq ~]$ vi /home/shuqiq/.jupyter/jupyter_notebook_config.py # Nginx访问时会出现跨域访问,需要在这里允许 c.NotebookApp.allow_origin = '*' # 禁止随意修改密码 c.NotebookApp.allow_password_change = False # 是否允许远程访问 c.NotebookApp.allow_remote_access = True # IP自己的ip c.NotebookApp.ip = 'ip' # 端口,自定义 c.NotebookApp.port = 9820 # 工作目录,自定义 c.NotebookApp.notebook_dir = '/jupyter/' # 启动Jupyter Notebook之后是否打开浏览器 c.NotebookApp.open_browser = False # 客户端打开Jupyter Notebook的密码哈希值 c.NotebookApp.password = 'sha1:7a75f56c1667:34209c98504382b676d726efb9ba7af95a28465f' 启动 [shuqiq@shuqiq bin]$ ./jupyter notebook #root用户使用下面的命令启动 jupyter notebook --allow-root去浏览器查看,如下图证明成功: 如果jupyter notebook打不开就查看一下自己的防火墙 #查看防火墙 systemctl status firewalld #关闭防火墙命令 sudo systemctl stop firewalld或者是ip没修改 或者是设置密码没对再在ipython里使用 from IPython.lib import passwd 重新设置密码 关闭进程: 使用 ctrl+c 然后输入 y 结束 #lsof是需要安装的插件,是查看端口被哪个进程占用 [shuqiq@shuqiq ~]$ kill -9 `lsof -n -i:9820 | grep jupyter | awk '{print $2}'` ### [shuqiq@shuqiq ~]$ kill -9 `ps -aux | grep jupyter | grep -v "grep" | awk '{print $2}'` |
CopyRight 2018-2019 实验室设备网 版权所有 |